import request from '@/utils/request'
import type { swiper, swiperQuery } from '@/types/swiper'
import type { ApiRes } from '@/types/data'

//带条件分页查询轮播图列表
export const getSwiperList = (params: swiperQuery) => {
  return request<ApiRes<{ total: number; items: swiper[] }>>({
    url: 'banner/list',
    params
  })
}
//增加轮播图
interface dialogForm {
  bannerid?: string
  img: string
  link: string
  alt: string
  flag: boolean
}
export const AddSwiper = (data: dialogForm) => {
  return request({
    url: 'banner/add',
    method: 'POST',
    data
  })
}
//修改轮播图
export const updateSwiper = (data: dialogForm) => {
  return request({
    url: 'banner/update',
    method: 'POST',
    data
  })
}
//删除轮播图
export const deleteSwiper = (bannerid: string) => {
  return request({
    url: `banner/delete/${bannerid}`,
    method: 'DELETE'
  })
}
